﻿@model ProjectThemeSelectorModel
@using SDF.Core;
@using SDF.Core.Infrastructure;
@using SDF.Web.Models.Common;
@if (Model.AvailableProjectThemes.Count > 1)
{
    var webHelper = EngineContext.Current.Resolve<IWebHelper>();
    var themes = Model.AvailableProjectThemes.Select(x => new SelectListItem
    {
        Text = x.Title,
        Value = webHelper.ModifyQueryString(Url.Action("SetProjectTheme", "Common", new { themename = x.Name }), "returnurl=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl), null),
        Selected = x.Name.Equals(Model.CurrentProjectTheme.Name, StringComparison.InvariantCultureIgnoreCase)
    });
    <div class="theme-selector">
        @Html.DropDownList("project-theme", themes, new { onchange = "setLocation(this.value);" })
    </div>
}